<template>
  <div class="ligin-user">
    <video width="100%" src="https://search-operate.cdn.bcebos.com/5adc7361b68c4209a9b9b0264884d09a.mp4" poster="https://search-operate.cdn.bcebos.com/58e56e39e0e5d48cc5a5ac78ddf40c84.png" muted="true" autoplay="true" auto-rotate="false" playsinline="true" x5-playsinline="true" webkit-playsinline="true" t7-video-player-type="inline" crossorigin="anonymous" loop="true"></video>
    <div class="ligin-user-right">
      <h1>webgis第8组—极端天气预测预警系统</h1>
     <span class="span"
        >请登录系统</span
      >
      <br />
	  <span class="span"
	          >默认账户和密码：admin      123456</span
	        >
	<br />
      <br />
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="70px"
        class="demo-ruleForm"
      >
        <el-form-item label="账户" prop="username">
          <el-input v-model="ruleForm.username"></el-input>
        </el-form-item>
        <el-form-item label="密码" prop="password">
          <el-input v-model="ruleForm.password" show-password></el-input>
        </el-form-item>
      </el-form>
      <br />

      <div class="submit">
        <el-button
          @click="submitForm('ruleForm')"
        type="info"
          style="width: 60%; color: white; margin: 0 auto"
          icon="el-icon-upload"
          >确认登陆</el-button
        >
      </div>
      <br />
      <br />
    
    </div>
    <div class="ligin-user-left">
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userList: [],

      ruleForm: {
        username: "",
        password: "",
      },
      rules: {
        username: [
          { required: true, message: "请输入用户名", trigger: "blur" },
        ],
        password: [{ required: true, message: "请输入密码", trigger: "blur" }],
      },

    };
  },

  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          //   console.log(this.ruleForm);
          if (
            this.ruleForm.username === "admin" &&
            this.ruleForm.password === "123456"
          ) {
            sessionStorage.setItem("username", this.ruleForm.username);
            this.$notify({
              title: "登陆成功",
              type: "success",
            });
            this.$router.push("/ThreeDaysW");
          } else {
            this.$message.error("用户名或密码错误");
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  },
};
</script>

<style>
.ligin-user {
  height: 100vh;
  /* background-image: url("../../public/amazing-beautiful-beauty-blue-59398176ba38e3c01b3c1dc40debd381.jpg"); */
  background-size: cover;
  overflow: hidden;
}
.ligin-user-right {
  position: absolute;
  top: 180px;
  left: 50%;
  margin-left: -245px;
  width: 560px;
  padding: 0 30px;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 15px;
}
.ligin-user-right h1 {
  margin-bottom: 0;
}
.ligin-user-right .span {
  margin: 0;
  color: #919597;
}
.ligin-user-right .span a {
  color: #2e58ff;
  text-decoration: none;
}
.submit {
  text-align: center;
}
.title {
  color: white;
}
.ligin-user-left {
  position: absolute;
  left: 100px;
  top: 45%;
  margin-top: -50px;
}
.ligin-user-left h1 {
  font-size: 40px;
  margin: 0;
}
.ligin-user-left p {
  font-size: 30px;
  margin: 0;
  font-weight: 300;
}
</style>